

#pragma once 

#ifndef __GC_MIDDLEWARE_H__
#define __GC_MIDDLEWARE_H__

#include <opencv2/opencv.hpp>
#include <string>
#include "json.hpp"
#include "httplib.h"

#include "utils_misc.h"
#include "inout_track.h"
#include "cache.hpp"
#include "lru_cache_policy.hpp"
#include "types.h"

using namespace std;
using namespace cv;

extern GC_APP_CONFIG gc_app_config;
extern std::map<std::string, int> PLATE_COLOR_MAP;
// extern caches::fixed_sized_cache<const char*, cv::Mat, caches::LRUCachePolicy> IMG_CACHE;

namespace gc
{
    class Middleware : public Singleton<Middleware>
    {
        public:
            Middleware();
	        virtual ~Middleware(void);
            
            nlohmann::json Upload_parking_status_image(const std::string& camera_key, cv::Mat mat,  const char* time_str);
            nlohmann::json Upload_inout_data(GCTrackResult &track_result);

        private:
            httplib::Client* httpClient(void);
        
        private:
            httplib::Client *m_client;
    };
}

#endif